package com.dhy.config;



import com.github.xiaoymin.knife4j.spring.annotations.EnableKnife4j;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.oas.annotations.EnableOpenApi;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Contact;
import springfox.documentation.service.VendorExtension;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;

import java.util.ArrayList;


@EnableKnife4j
@Configuration
@EnableOpenApi
public class SwaggerConfig {
    /*配置Swagger的Docket的bean实例*/
    @Bean
    public Docket docket()
    {
        return new Docket(DocumentationType.OAS_30)
                .apiInfo(apiInfo())
                .groupName("空教室")
                .select()
                .apis(RequestHandlerSelectors.basePackage("com.dhy.controller"))
                .paths(PathSelectors.any())
                .build();
    }

    /*配置Swagger信息*/
    private ApiInfo apiInfo() {
        return new ApiInfo(
                "空教室小程序",
                "空教室小程序API文档",
                "2.0",
                "https://blog.csdn.net/m0_53157173",
                new Contact("大忽悠", "https://blog.csdn.net/m0_53157173", "3076679680@qq.com"),
                /*Contact(String name, String url, String email)*/
                "Apache 2.0",
                "http://www.apache.org/licenses/LICENSE-2.0",
                new ArrayList<VendorExtension>());
    }

}
